<!DOCTYPE html>
<html lang="en" xmlns:th="http://www.thymeleaf.org" xmlns:sec="http://www.thymeleaf.org/thymeleaf-extras-springsecurity5">
<head>
    <meta charset="UTF-8">
    <title>图书借阅系统后台管理</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" th:href="@{/static/layuiadmin/layui/css/layui.css}" media="all">
    <link rel="stylesheet" th:href="@{/static/layuiadmin/style/admin.css}" media="all">
</head>
<body class="layui-layout-body">
<div id="LAY_app">
    <div class="layui-layout layui-layout-admin">
        <div class="layui-header">
            <!-- 头部区域（可配合layui 已有的水平导航） -->
            <ul class="layui-nav layui-layout-left">
                <li class="layui-nav-item layadmin-flexible" lay-unselect>
                    <a href="javascript:;" layadmin-event="flexible" title="侧边伸缩">
                        <i class="layui-icon layui-icon-shrink-right" id="LAY_app_flexible"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;" layadmin-event="refresh" title="刷新">
                        <i class="layui-icon layui-icon-refresh-3"></i>
                    </a>
                </li>
            </ul>
            <ul class="layui-nav layui-layout-right" lay-filter="layadmin-layout-right">

                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="theme">
                        <i class="layui-icon layui-icon-theme"></i>
                    </a>
                </li>
                <li class="layui-nav-item layui-hide-xs" lay-unselect>
                    <a href="javascript:;" layadmin-event="fullscreen">
                        <i class="layui-icon layui-icon-screen-full"></i>
                    </a>
                </li>
                <li class="layui-nav-item" lay-unselect>
                    <a href="javascript:;">
                        <cite sec:authentication="principal.name"></cite>
                    </a>
                    <dl class="layui-nav-child">
                        <dd><a lay-href="user/info">基本资料</a></dd>
                        <dd><a lay-href="user/password">修改密码</a></dd>
                        <hr>
                        <dd style="text-align: center;"><a lay-href="logout">退出</a></dd>
                    </dl>
                </li>
            </ul>
        </div>

        <div class="layui-side layui-side-menu">
            <div class="layui-side-scroll">
                <div class="layui-logo">
                    <span>图书借阅系统后台管理</span>
                </div>

                <!-- 左侧导航区域（可配合layui已有的垂直导航）系统管理员权限 -->
                <ul class="layui-nav layui-nav-tree" lay-filter="test" sec:authorize="hasRole('ROLE_ADMIN')">
                    <li data-name="home" class="layui-nav-item layui-this">
                        <a href="javascript:;" lay-href="home/manage" lay-tips="主页" class="home" lay-direction="2">
                            <i class="layui-icon layui-icon-home"></i>
                            <cite>主页</cite>
                        </a>
                    </li>
                    <li data-name="book" class="layui-nav-item">
                        <a href="javascript:;" lay-tips="图书管理" lay-direction="2">
                            <i class="layui-icon layui-icon-app"></i>
                            <cite>图书管理</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd data-name=""><a lay-href="book/bookType">图书类型</a></dd>
                            <dd data-name=""><a lay-href="book/bookInformation">图书信息</a></dd>
                            <dd data-name=""><a lay-href="book/bookRepertory">库存</a></dd>
                        </dl>
                    </li>
                    <li data-name="user" class="layui-nav-item">
                        <a href="javascript:;" lay-tips="用户管理" lay-direction="2">
                            <i class="layui-icon layui-icon-user"></i>
                            <cite>用户管理</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd data-name=""><a lay-href="role/userType">用户权限</a></dd>
                            <dd data-name=""><a lay-href="user/userInformation">用户信息</a></dd>
                        </dl>
                    </li>
                    <li data-name="borrow" class="layui-nav-item">
                        <a href="javascript:;" lay-href="borrow/information" class="information" lay-tips="借阅记录" lay-direction="2">
                            <i class="layui-icon layui-icon-template"></i>
                            <cite>借阅记录</cite>
                        </a>
                    </li>
                    <li data-name="record" class="layui-nav-item">
                        <a href="javascript:;" lay-href="record" lay-tips="操作日志" class="record" lay-direction="2">
                            <i class="layui-icon layui-icon-form"></i>
                            <cite>操作日志</cite>
                        </a>
                    </li>
                </ul>

                <!--图书管理员权限-->
                <ul class="layui-nav layui-nav-tree" lay-filter="test" sec:authorize="hasRole('ROLE_BOOKS')">
                    <li data-name="home" class="layui-nav-item layui-this">
                        <a href="javascript:;" lay-href="home/manage" lay-tips="主页" class="home" lay-direction="2">
                            <i class="layui-icon layui-icon-home"></i>
                            <cite>主页</cite>
                        </a>
                    </li>
                    <li data-name="book" class="layui-nav-item">
                        <a href="javascript:;" lay-tips="图书管理" lay-direction="2">
                            <i class="layui-icon layui-icon-app"></i>
                            <cite>图书管理</cite>
                        </a>
                        <dl class="layui-nav-child">
                            <dd data-name=""><a lay-href="book/bookType">图书类型</a></dd>
                            <dd data-name=""><a lay-href="book/bookInformation">图书信息</a></dd>
                            <dd data-name=""><a lay-href="book/bookRepertory">库存</a></dd>
                        </dl>
                    </li>
                    <li data-name="borrow" class="layui-nav-item">
                        <a href="javascript:;" lay-href="borrow/information" class="information" lay-tips="借阅记录" lay-direction="2">
                            <i class="layui-icon layui-icon-template"></i>
                            <cite>借阅记录</cite>
                        </a>
                    </li>
                </ul>

            </div>
        </div>

        <div class="layadmin-pagetabs" id="LAY_app_tabs">
            <div class="layui-icon layadmin-tabs-control layui-icon-prev" layadmin-event="leftPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-next" layadmin-event="rightPage"></div>
            <div class="layui-icon layadmin-tabs-control layui-icon-down">
                <ul class="layui-nav layadmin-tabs-select" lay-filter="layadmin-pagetabs-nav">
                    <li class="layui-nav-item" lay-unselect>
                        <a href="javascript:;"></a>
                        <dl class="layui-nav-child layui-anim-fadein">
                            <dd layadmin-event="closeThisTabs"><a href="javascript:;">关闭当前标签页</a></dd>
                            <dd layadmin-event="closeOtherTabs"><a href="javascript:;">关闭其它标签页</a></dd>
                            <dd layadmin-event="closeAllTabs"><a href="javascript:;">关闭全部标签页</a></dd>
                        </dl>
                    </li>
                </ul>
            </div>
            <div class="layui-tab" lay-unauto lay-allowClose="true" lay-filter="layadmin-layout-tabs">
                <ul class="layui-tab-title" id="LAY_app_tabsheader">
                    <li lay-id="home/manage" lay-attr="home/manage" class="layui-this"><i class="layui-icon layui-icon-home"></i></li>
                </ul>
            </div>
        </div>

        <div class="layui-body" id="LAY_app_body">
            <!-- 内容主体区域 -->
            <div class="layadmin-tabsbody-item layui-show">
                <iframe src="home/manage" frameborder="0" class="layadmin-iframe" id="main"></iframe>
            </div>
        </div>
    </div>
</div>
<script th:src="@{/static/layuiadmin/layui/layui.js}"></script>
<script>
    //JS
    layui.config({
        base: '../static/layuiadmin/' //静态资源所在路径
    }).extend({
        index: 'lib/index' //主入口模块
    }).use(['element', 'layer', 'jquery','index'],function(){
        var element = layui.element;
        var $ = layui.jquery;
        var layer = layui.layer;
        $(document).ready(function () {
            $("dd>a").click(function (e) {
                var href = $(this).attr('lay-href');
                if (href == 'logout'){
                    location.href = href;
                }/*else if(href == 'user/password'){
                    layer.open({
                        title: '修改密码',
                        type: 2,
                        shade: false,
                        maxmin: true,
                        content: "changePwd",
                        area: ['893px', '480px'],
                        btn: ['确定', '取消'],
                        yes:function(){	//虚拟化表单参数类型不是json，所以这里用的是回调提交
                        },
                        //弹出层打开回调
                        success: function(layero, index){
                            var form=layui.form;
                            //找到确定按钮，添加属性，变成提交按钮
                            layero.addClass('layui-form');
                            var submitBtn=layero.find('.layui-layer-btn0');
                            submitBtn.attr('lay-filter','formVerify').attr('lay-submit','');
                            layero.keydown(function(e){
                                if(e.keyCode==13){
                                    submitBtn.click();
                                }
                            });
                            form.on('submit(formVerify)', function(data){
                                var body = layer.getChildFrame('body', index).contents().serialize();
                                $.post("saveInformation?" + body, function(result){
                                    if(result.success){
                                        layer.close(index);
                                        table.reload('user-information-table',{where:that.where});
                                    }
                                    layer.msg(result.msg);
                                });
                            });
                        }
                    })
                }else{
                    e.preventDefault();
                    $('#main').attr('src',$(this).attr('lay-href'));
                }*/
            });
        })
    });
</script>
</body>
</html>